package operator.create;

import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import util.Printer;

class ErrorOperator {

    public static void main(String[] args) {
        error();
    }

    //最多不超过10个
    static void error(){
        Observable.error(new RuntimeException("test")).subscribe(new Observer<Object>() {
            @Override
            public void onSubscribe(Disposable d) {
                Printer.print("error onSubscribe");
            }

            @Override
            public void onNext(Object object) {
                Printer.print("error onNext");
            }

            @Override
            public void onError(Throwable e) {
                Printer.print("error onError");
                Printer.print(e.toString());
            }

            @Override
            public void onComplete() {
                Printer.print("error onComplete");
            }
        });
    }

}
